package lol.clann.minecraft.springboot.api.utils;

import com.ruoshui.utils.java.exception.ExceptionUtils;
import org.bukkit.plugin.java.JavaPlugin;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;

import java.lang.reflect.Field;

/**
 *
 * @author pyz
 * @date 2019/4/8 9:27 PM
 */
public class BeanRegisterUtils {

    public static void register(String beanName, Object bean, BeanDefinitionRegistry registry) {
        Class pluginClass = bean.getClass();
        RootBeanDefinition rbd = new RootBeanDefinition(pluginClass);
        rbd.setInstanceSupplier(() -> bean);
        registry.registerBeanDefinition(beanName, rbd);
    }
}
